14. Positional Controller

Positional Controller

By now you should have a well tuned hover and attitude controller. You can begin to work on the positional controller.

As mentioned in Cascade Control, the positional controller sits in the outer loop of a Cascade PID controller, responsible for commanding the attitude and thrust vectors in order to achieve a goal orientation in three dimensional space.

Remember that to control the motion of a quadrotor along its x-axis, you must adjust the pitch (rotation along y-axis). While motion along the y-axis can be controlled by adjusting the roll (rotation along x-axis).

The positional controller determines the desired roll and pitch angle values based on error values calculated from the difference between the desired and current y-positions and x-positions of the quadrotor, respectively.

These desired roll and pitch angles are then fed to the attitude controller, that runs in the inner loop, for final roll and pitch control.

Additionally, the positional controller also includes the hover controller discussed previously for controlling the quadrotor motion along the z-axis.

An example implementation of the position_controller_node is provided in the quad_controller package that utilizes the PID controller class that you have implemented.

To test this Positional Controller, you need to follow similar steps as before and make sure that your are starting the steps over for each controller type and that you do not have more than one controller running at a time:
:

  • Fire up roscore:
    sh $ roscore

  • Launch the simulator: Follow the steps presented in the README file.

  • Run the position_controller_node:
    sh $ roslaunch quad_controller position_controller.launch

You know the drill! Just like before, you must use dynamic_reconfigure to set target values for x, y, and z position and tune the PID controller for x, and y controllers.

Luckily, you must have saved your PID parameters from the Hover Controller, those can be used directly for the z-controller. Also, your saved parameters for the Attitude Controller can be reused.

Note: ZN and Twiddle Tuner nodes only work with the Hover Controller, they will not function correctly with the Positional Controller.